<script setup lang="ts">
import { getLoginUser } from '@/api/auth';
import { sayHello, err } from '@/api/test';
import { userStore } from '@/store/user';
import type { LoginUser } from '@/model/System';

const sent = async () => {
  const res = await sayHello();
  console.log(res);
};

const user = userStore();
const show = userStore();

const getUser = async () => {
  const res: LoginUser = await getLoginUser();
  console.log(res);
};

const logout = () => {
  user.logout();
};
</script>

<template>
  <h3>test page</h3>

  <div>
    <h5>pinia</h5>
    <p>User: {{ show.user }}</p>
    <el-input v-model="user.user.name"></el-input>
  </div>
  <div>
    <h5>axios</h5>
    <el-button @click="sent()">hello</el-button>
    <el-button @click="err()">error</el-button>
  </div>
  <div>
    <h5>permission</h5>
    <el-button @click="getUser()">getLoginUser</el-button>
    <el-button @click="logout()">logout</el-button>
  </div>
</template>
